package com.situ.vivamarket.model;

import com.situ.vivamarket.util.MemAddGroup;
import com.situ.vivamarket.util.MemEditGroup;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import jakarta.validation.constraints.NotEmpty;
import org.hibernate.validator.constraints.Length;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 会员
 */
@Getter
@Setter
@ToString
public class Member {
    private Integer id;
    @NotEmpty(message = "账号不可为空", groups = {MemAddGroup.class})
    @Length(min = 3, max = 20, message = "账号长度必须介于3~20", groups = {MemAddGroup.class})
    private String account;
    @NotEmpty(message = "密码不可为空", groups = {MemAddGroup.class})
    private String password;
    @NotEmpty(message = "姓名不可为空", groups = {MemAddGroup.class, MemEditGroup.class})
    private String name;
    private String sex;
    private LocalDate birthday;
    @Length(min = 11, max = 11, message = "手机号长度必须是11位", groups = {MemAddGroup.class, MemEditGroup.class})
    private String phone;
    @Email(message = "邮箱格式不合规")
    private String email;
    @Length(min = 18, max = 18, message = "身份证号长度必须是18位", groups = {MemAddGroup.class, MemEditGroup.class})
    private String cardId;
    private String avatar;
    private String description;
    private LocalDateTime createdTime;
    private String createdBy;
    private LocalDateTime updatedTime;
    private String updatedBy;

}
